package com.beidu.lottery.call.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 素材类型枚举
 *
 * @author 北渡
 */
@Getter
@AllArgsConstructor
public enum MaterialTypeEnum {

    VIDEO(0, new String[]{".MPG", ".MPEG", ".AVI", ".MP4", ".3GP", ".RM", ".RMVB", ".MOV", ".FLV", ".ASF", ".WMA", ".MP3", ".M4A"}),
    IMAGE(1, new String[]{".JPG", ".PNG", ".GIF"}),
    ;

    /**
     * 类型id
     */
    private final Integer id;

    /**
     * 类型数组
     */
    private final String[] value;

    /**
     * 根据id获取素材类型
     *
     * @param value 素材id
     * @return 素材类型数组
     */
    public static String[] getValueById(int value) {
        for (MaterialTypeEnum type : values()) {
            if (type.id == value) {
                return type.getValue();
            }
        }
        throw new IllegalArgumentException("No enum with value: " + value);
    }

}
